<?php
//我的提案

function daifankui_default(){
    daifankui_page();
}
function daifankui_page(){
    _output_template(0,'daifankui');
}


function _zhengxie_outputDaifankui(){
    $nav_name = '待反馈提案:';
    if (empty($_REQUEST['proposalID'])){
        $str= " <div style='padding: 25px; border-radius: 10px;height: 93%;background-color: white; -webkit-box-shadow: #e2f0fe 0px 0px 10px;-moz-box-shadow: #e2f0fe 0px 0px 10px;box-shadow: #e2f0fe 0px 0px 10px;'>
                <div style='width: 100%;min-height: 120px;height: 10%'>
                    <div class='mark' id='".$GLOBALS['ACTION']."' style='color: #429de3;height: 50%;font-size: 18px;'>".$nav_name."</div>
                    <div style='height: 50%;'>";
        $str.="         <div class='box' style='float: left;height: 100%;display: inline-block;position: relative;top: 50%;transform: translateY(-50%)'>
                            <span style='font-size: 16px;float: left;height: 40px;line-height: 40px;margin-right: 15px;position: relative;top: 50%;transform: translateY(-50%)'>状态:</span>
                            <span style='font-size: 16px;color: #666;text-indent: 15px;border: 1px solid #e5e5e5;float: left;border-radius: 4px;width:204px;height:40px;line-height:40px;position: relative;top: 50%;transform: translateY(-50%)'>待反馈</span>
                        </div>
                        ";

        $str .= "           <div style='display: inline-block;width: 33%;height: 100%;margin-left: 10%;float: left'>
                            <div style='height: 54px;position: relative;top: 50%;transform: translateY(-50%);'>
                                <span style='font-size: 16px;float: left;height: 50px;line-height: 50px;'>提案理由:</span>
                                <div style='padding-left: 80px;position: relative;top: 50%;transform: translateY(-50%)'>
                                    <input class='anyou_search' type='text' style='font-size: 16px;color: #666;height: 40px;width: 100%;border: 1px solid #e5e5e5;border-radius: 4px;'>
                                </div>
                            </div>
                            <!--<input type='text' style='font-size: 16px;color: #666;height: 40px;width: 100%;border: 1px solid #e5e5e5;border-radius: 4px;position: relative;top: 50%;transform: translateY(-50%);'>-->
                        </div>
                        <div style='display: inline-block; height: 100%;float: left;margin-left: 15px'>
                            <div style='height: 54px;position: relative;top: 50%;transform: translateY(-50%);'>
                                <button onclick='searchProposalToMark(1);' style='font-size: 16px;color: white;border-radius: 5px;background-color: #42d79e;width: 76px;height: 41px;margin-right: 15px;margin-left: 15px;border: none'>查询</button>
                                <button onclick='resetMessage(1);' style='font-size: 16px;color: #42d79e;border-radius: 5px;border: 1px solid #42d79e;background-color: #fff;width: 76px;height: 41px;'>重置</button>
                            </div>
                        </div>";

        $str.=output_tab();
        return $str;


    }else{

        //取出参数
        $proposalID =  $_REQUEST['proposalID'];
        $data = getProposalInfo($proposalID);
        $userInfo = getUserInfo($data['userid']);

        isset($_REQUEST['taskid'])? updateLookState($_REQUEST['taskid']) : '';

        //取出提案答复内容
        $dafu = getProposalRecordToLast($proposalID);

        //承办单位(查表暂留)
        $sponsorData = getSponsorUnitToID($data['sponsor']);//获取承办单位
        $assistData = getAssistUnitToID($data['assist']);//获取协办单位


        $str ="<div style='padding: 25px 50px;  border-radius: 10px;height: 93%;background-color: white; -webkit-box-shadow: #e2f0fe 0px 0px 10px;-moz-box-shadow: #e2f0fe 0px 0px 10px;box-shadow: #e2f0fe 0px 0px 10px;'>
                        <div style='height: 8%;width: 100%;'>
                                <div class='curentProposal' id='".$data['id']."' style='font-size: 22px;color: #333333;'>查看提案答复</div>
                        </div>
                        
                        <div style='height: 10%;width: 100%'>
                            <div class='proposalNum' id='".$proposalID."' style='text-indent: 10px;background-image: url(/images/xinjian/xingxing.png);background-repeat: no-repeat;background-position: 10px 38px;font-size: 20px;text-align: center;display: inline-block;min-width: 99px;width: 150px;height:100%;float: left;line-height: 4.5'>
                                案&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;由:
                            </div>
                            <div style='padding-left: 150px;height: 100%;'>
                                <input type='text' disabled='disabled' value='".$data['anyou']."' style='text-indent: 10px;background-color: #fafdff;border: 1px solid #ececec;color: black;font-size: 20px;width: 100%;position: relative;top: 50%;transform: translateY(-50%);height: 58px'>
                            </div>
                        </div>";

        //1：经济类 2：文教体卫 3：政法统战政协
        switch ($data['type']){
            case 1:
                $proposalType = '经济类';
                break;
            case 2:
                $proposalType = '文教体卫';
                break;
            case 3:
                $proposalType = '政法统战政协';
                break;
        }

        $str .= "   <div style='height: 10%;margin-top: 1%;width: 48%;float: left'>
                            <div style='background-image: url(/images/xinjian/xingxing.png);background-repeat: no-repeat;background-position: 10px 38px;font-size: 20px;text-align: center;display: inline-block;min-width: 99px;width: 150px;height:100%;float: left;line-height: 4.5'>
                                提案类型:
                            </div>
                            <div  style='padding-left: 150px;height: 100%;'>
                                <input type='text' disabled='disabled' value='".$proposalType."' style='text-indent: 10px;text-align: left;background-color: #fafdff;line-height: 58px;border: 1px solid #ececec;color: #333;font-size: 20px;width: 100%;position: relative;top: 50%;transform: translateY(-50%);height: 58px'>
                            </div>
                        </div>";

        $str .= "   <div style='height: 10%;margin-top: 1%;width: 48%;margin-left: 4%;display: inline-block;'>
                            <div style='background-image: url(/images/xinjian/xingxing.png);background-repeat: no-repeat;background-position: 10px 38px;font-size: 20px;text-align: center;display: inline-block;min-width: 99px;width: 150px;height:100%;float: left;line-height: 4.5'>
                               届&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次:
                            </div>
                            <div style='padding-left: 150px;height: 100%;'>
                                <input type='text' disabled='disabled' value='".$data['session']."' style='text-indent: 10px;text-align: left;background-color: #fafdff;line-height: 58px;border: 1px solid #ececec;color: #333;font-size: 20px;width: 100%;position: relative;top: 50%;transform: translateY(-50%);height: 58px'>
                            </div>
                        </div>";

        $str .= "   <div style='height: 10%;margin-top: 1%;width: 48%;float: left'>
                            <div style='background-image: url(/images/xinjian/xingxing.png);background-repeat: no-repeat;background-position: 10px 38px;font-size: 20px;text-align: center;display: inline-block;min-width: 99px;width: 150px;height:100%;float: left;line-height: 4.5'>
                                提&nbsp;&nbsp;案&nbsp;&nbsp;人:
                            </div>
                            <div  style='padding-left: 150px;height: 100%;'>
                                <input class='userid_flag' id='".$userInfo['id']."' type='text' disabled='disabled' value='".$userInfo['username']."' style='text-indent: 10px;text-align: left;background-color: #fafdff;line-height: 58px;border: 1px solid #ececec;color: #333;font-size: 20px;width: 100%;position: relative;top: 50%;transform: translateY(-50%);height: 58px'>
                            </div>
                        </div>";


        $str .= "   <div style='height: 10%;margin-top: 1%;width: 48%;margin-left: 4%;display: inline-block;'>
                            <div style='font-size: 20px;text-align: center;display: inline-block;min-width: 99px;width: 150px;height:100%;float: left;line-height: 4.5'>
                                附&nbsp;&nbsp;议&nbsp;&nbsp;人:
                            </div>
                            <div style='padding-left: 150px;height: 100%;'>
                                <input type='text' disabled='disabled' value='".$data['follower']."' style='text-indent: 10px;text-align: left;background-color: #fafdff;line-height: 58px;border: 1px solid #ececec;color: #333;font-size: 20px;width: 100%;position: relative;top: 50%;transform: translateY(-50%);height: 58px'>
                            </div>
                        </div>";
        //主办单位, 暂留
        //$sponsor = getSponsor($data['sponsor']);


        $str .= "       <div style='height: 10%;margin-top: 1%;width: 48%;display: inline-block;'>
                            <div style='background-image: url(/images/xinjian/xingxing.png);background-repeat: no-repeat;background-position: 10px 38px;font-size: 20px;text-align: center;display: inline-block;min-width: 99px;width: 150px;height:100%;float: left;line-height: 4.5'>
                               主办单位:
                            </div>
                            <div style='padding-left: 150px;height: 100%;'>
                                <input type='text' disabled='disabled' value='".$sponsorData['unitname']."' style='text-indent: 10px;text-align: left;background-color: #fafdff;line-height: 58px;border: 1px solid #ececec;color: #333;font-size: 20px;width: 100%;position: relative;top: 50%;transform: translateY(-50%);height: 58px'>
                            </div>
                        </div>
                        
                        <div style='height: 10%;margin-top: 1%;width: 48%;margin-left: 4%;float: right;display: inline-block;'>
                            <div style='font-size: 20px;text-align: center;display: inline-block;min-width: 99px;width: 150px;height:100%;float: left;line-height: 4.5'>
                                文&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;件:
                            </div>
                            <div style='padding-left: 150px;height: 100%;background-image:url(/images/shencha/wordplus.png);background-repeat: no-repeat;background-position: 140px 27px;'>
                                <div style='position: relative;top: 21%'>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href='?action=daifankui&proposalID=".$proposalID."&filelist=".$data['enclosureid']."' style='color:#429de3;'>查看/下载</a>
                                </div>
                            </div>
                        </div>
                        
                        <!--<div style='width: 33%;height:38px;line-height:38px;float: left;font-size: 16px;color: #666666;background-image:url(/images/shencha/word.png);background-repeat: no-repeat;background-position: 45px;'>文件:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style='color:#429de3;'>查看</a><span style='color:#429de3;'>/</span><a style='color:#429de3;'>下载</a></div>-->

                        <!--<div style='height: 10%;margin-top: 1%;width: 48%;display: inline-block;'>
                            <div style='width: 33%;height:38px;line-height:38px;float: left;font-size: 16px;color: #666666;background-image:url(/images/shencha/word.png);background-repeat: no-repeat;background-position: 45px;'>文件:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style='color:#429de3;'>查看</a><span style='color:#429de3;'>/</span><a style='color:#429de3;'>下载</a></div>
                        </div>-->
                        
                        <div style='height: 30%;margin-top:3%;width: 100%'>
                            <div style='text-indent: 10px;font-size: 20px;text-align: center;display: inline-block;min-width: 99px;width: 150px;height:100%;float: left;line-height: 3.5'>
                                提案答复:
                            </div>
                            <div style='padding-left: 150px;height: 100%;'>
                                <textarea  disabled='disabled' style='text-indent: 10px;overflow: auto;resize: none;background-color: #fafdff;border: 1px solid #ececec;color: black;font-size: 20px;width: 100%;position: relative;top: 50%;transform: translateY(-50%);height: 100%'>".$dafu['remarks']."</textarea>
                            </div>
                        </div>
                        
                        <script type='text/javascript'>
                            function showReuseDialog(){
                                $('.reuse_dialog').show();
                            }
                        </script>";
        error_log('enclosureid->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'.$data['enclosureid']);
        if($GLOBALS['ACTION'] != 'wode'){
            $str.="<div style='height: 15%;width: 100%;text-align: center;'>
                        <a href='?action=daifankui&proposalID=".$proposalID."&fankui=1'  style='width: 260px;height: 68px;display: inline-block;margin: 0px auto;position: relative;top: 50%;transform: translateY(-50%);'>
                            <div style='text-align: center;margin:0px auto;line-height:68px;background-color: #4e99ff;border-radius: 4px;color: white;font-size: 20px'>反馈</div>
                        </a>
                   </div>";
        }

            $str.="</div>";
        return $str;
    }
}


function zhengxie_outputDaiFanKuiDialog($data){

    if (!empty($data)){
        $str = "<div style='position: absolute;top: 25%;margin-left: 210px;left: 45%;transform: translateX(-50%); width: 686px;height: 480px;'>
                    <div style='background-color: #3e8ffe;background-size: 100% 100%;border-top-left-radius: 8px;border-top-right-radius: 8px;height: 82px;width: 100%;line-height: 82px;text-align: center;color: white;font-size: 20px;'>
                        反馈
                        <div class='main_dialog_cuohao' onclick='dissmissdialog()' style='position: relative;top: -20px;background-image: url(images/main/cuohao.png);background-position: center;background-repeat:no-repeat;background-size: 15px;width:40px;height: 82px;float: right'></div>
                    </div>
                    <div style='background-color: white;height: 320px;width: 100%;'>
                        <div style='width: 550px;height: 320px;background-color: white;margin: 0px auto;'>
                            <div style='width: 550px;height: 60px;'>
                                <div class='choose' style='position: relative;top: 25px;'>
                                    <label class='radio'>满意<input disabled type='radio' name='radio' value='1' ><i></i></label>
                                    <label class='radio' style='position: relative;left: 25%; '>基本满意<input disabled type='radio' value='2' name='radio'><i></i></label>
                                    <label class='radio' style='float: right'>不满意<input disabled type='radio' value='3' name='radio' checked><i></i></label>
                                </div>
                                <style>
                                    .choose {position: relative;}
                                    .choose .radio {position: relative;display: inline-block;font-weight: 400;color: #666666;padding-left: 35px;height: 30px;cursor: pointer;line-height: 30px;font-size: 18px;}
                                    .choose .radio input {position: absolute;left: -9999px;}
                                    .choose .radio i {display: block;position: absolute;top: 2px;left: 0;width: 26px;height: 26px;outline: 0;border: 1px solid #e4e4e4;background: #ffffff;border-radius: 50%;background-image: url(images/daifankui/zhihui9.png);background-repeat: no-repeat;transition: border-color .3s;-webkit-transition: border-color .3s;}
                                    .choose .radio input + i:after {position: absolute;content: '';width: 26px;height: 26px;border-radius: 50%;opacity: 0;transition: opacity .1s;-webkit-transition: opacity .1s;background-image: url(images/daifankui/xuanzhong.png);background-repeat: no-repeat;}
                                    .choose .radio input:checked + i:after {opacity: 1;}
                                    .feedbackcontent::-webkit-input-placeholder{color:#cacaca;}
                                </style>
                            </div>
                            
                            <div style='width: 100%;height: 280px;color: #333333; font-size: 18px;margin-top: 16px;'>
                                具体建议<br>
                                <textarea class='feedbackcontent' disabled style='overflow:auto;text-indent: 10px;resize: none;;width: 100%;height: 160px;margin-top: 25px; color: #666666;font-size: 16px;background-color: #fafdff;border: 1px solid #f1f5f9;'>".$data['remarks']."</textarea>
                            </div>
                        </div>
                    </div>
                    <div style='background-color: #f0f6ff;background-size: 100% 100%;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;height: 78px;width: 100%;text-align: center;'>
                        <a onclick='dissmissdialog()' style='width: 210px;height: 48px;display: inline-block;margin: 0px auto;position: relative;top: 50%;transform: translateY(-50%);'><div style='text-align: center;line-height:48px;background-color: #3e8ffe;border-radius: 8px;color: white;font-size: 16px'>返&nbsp;回</div></a>
                    </div>
                </div>";
        return $str;
    }

    if (isset($_REQUEST['filelist'])) {
        //下载
        $str="<script>showdialog();</script>";
        $str .= "<div style='position: absolute;top: 25%;margin-left: 210px;left: 45%;transform: translateX(-50%); width: 686px;height: 480px;'>
                    <div style='background-color: #3e8ffe;background-size: 100% 100%;border-top-left-radius: 8px;border-top-right-radius: 8px;height: 82px;width: 100%;line-height: 82px;text-align: center;color: white;font-size: 20px;'>
                        <span style='position: absolute;left: 50%;transform: translateX(-50%)'>文件目录</span>
                        <div class='main_dialog_cuohao' onclick='dissmissdialog()' style='position: relative;top: -20px;background-image: url(images/main/cuohao.png);background-position: center;background-repeat:no-repeat;background-size: 15px;width:40px;height: 82px;float: right'></div>
                    </div>
                    <div style='background-color: white;height: 398px;width: 100%;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;'>
                        <div class='solide_box' style='width: 600px;height: 398px;background-color: white;overflow: auto;padding-top: 20px;margin: 0px auto;'>
                            <span style='color: #999999'>内容下载</span>";

        if ($_REQUEST['filelist'] != 0){
            $data = array();
            $sql = "select * from enclosure where id in(".$_REQUEST['filelist'].")";
            $result = $GLOBALS['DB']->query($sql);
            while($res=$result->fetch()) {
                $data[] = $res;
            }

            foreach ($data as $value){
                $str.="<div style='width: 100%;height: 50px;background: url(images/daifankui/wenjianjia.png) no-repeat 10px'>
                <div style='overflow: hidden;display: inline-block;margin-left: 50px;max-width: 350px;height: 50px;line-height: 50px'>".$value['enclosurename']."</div>
                <a href='".$value['enclosureurl']."' style='float: right;position: relative;top: 50%;transform: translateY(-50%)'><img style='width: 32px;height: 32px;' src='images/daifankui/xiazai.png'></a>
                <div style='color: #999999;max-width: 130px;height: 50px;line-height: 50px;margin-right: 20px;float: right'>".$value['enclosuretime']."</div>
             </div>";
            }
        }


                $str.="</div>
                    </div>
                </div>";
        return $str;
    }

    if (!empty($_REQUEST['fankui'])){
        $str = "<script>$('.reuse_dialog').show();</script>";
        $str .= "    <div class='commitDialog' style='position: absolute;top: 25%;margin-left: 210px;left: 45%;transform: translateX(-50%); width: 686px;height: 480px;'>
                    <div style='background-color: #3e8ffe;background-size: 100% 100%;border-top-left-radius: 8px;border-top-right-radius: 8px;height: 82px;width: 100%;line-height: 82px;text-align: center;color: white;font-size: 20px;'>
                        反馈
                        <div class='main_dialog_cuohao' onclick='dissmissdialog()' style='position: relative;top: -20px;background-image: url(images/main/cuohao.png);background-position: center;background-repeat:no-repeat;background-size: 15px;width:40px;height: 82px;float: right'></div>
                    </div>
                    <div style='background-color: white;height: 320px;width: 100%;'>
                        <div style='width: 550px;height: 320px;background-color: white;margin: 0px auto;'>
                            <div style='width: 550px;height: 60px;'>
                                <div class='choose' style='position: relative;top: 25px;'>
                                    <label class='radio'>满意<input class='manyi' type='radio' name='radio' value='1' checked><i></i></label>
                                    <label class='radio' style='position: relative;left: 25%; '>基本满意<input class='jibenmanyi' type='radio' value='2' name='radio'><i></i></label>
                                    <label class='radio' style='float: right'>不满意<input class='bumanyi' type='radio' value='3' name='radio'><i></i></label>
                                </div>
                                <style>
                                    .choose {position: relative;}
                                    .choose .radio {position: relative;display: inline-block;font-weight: 400;color: #666666;padding-left: 35px;height: 30px;cursor: pointer;line-height: 30px;font-size: 18px;}
                                    .choose .radio input {position: absolute;left: -9999px;}
                                    .choose .radio i {display: block;position: absolute;top: 2px;left: 0;width: 26px;height: 26px;outline: 0;border: 1px solid #e4e4e4;background: #ffffff;border-radius: 50%;background-image: url(images/daifankui/zhihui9.png);background-repeat: no-repeat;transition: border-color .3s;-webkit-transition: border-color .3s;}
                                    .choose .radio input + i:after {position: absolute;content: '';width: 26px;height: 26px;border-radius: 50%;opacity: 0;transition: opacity .1s;-webkit-transition: opacity .1s;background-image: url(images/daifankui/xuanzhong.png);background-repeat: no-repeat;}
                                    .choose .radio input:checked + i:after {opacity: 1;}
                                    .feedbackcontent::-webkit-input-placeholder{color:#cacaca;}
                                </style>
                            </div>
                            
                            <div style='width: 100%;height: 280px;color: #333333; font-size: 18px;margin-top: 16px;'>
                                具体建议<br>
                                <textarea class='feedbackcontent'  placeholder='不少于15字'  style='overflow:auto;text-indent: 10px;resize: none;;width: 100%;height: 160px;margin-top: 25px; color: #666666;font-size: 16px;background-color: #fafdff;border: 1px solid #f1f5f9;'></textarea>
                            </div>
                        </div>
                    </div>
                    <div style='background-color: #f0f6ff;background-size: 100% 100%;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;height: 78px;width: 100%;text-align: center;'>
                        <a onclick='commitFeedback();' style='width: 210px;height: 48px;display: inline-block;margin: 0px auto;position: relative;top: 50%;transform: translateY(-50%);'><div style='text-align: center;line-height:48px;background-color: #3e8ffe;border-radius: 8px;color: white;font-size: 16px'>确&nbsp;定</div></a>
                    </div>
                </div>";

        $str .= "   <div class='successDialog' style='display: none;position: absolute;top: 25%;margin-left: 210px;left: 45%;transform: translateX(-50%); width: 686px;height: 460px;'>
                        <div style='background-color: #429de3;background-image: url(/images/login/reset.png);background-size: 100% 100%;border-top-left-radius: 8px;border-top-right-radius: 8px;height: 194px;width: 100%'>
                            
                        </div>
                        <div style='background-color: white;height: 264px;width: 100%;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;'>
                            <div style='width: 390px;height: 190px;margin: 0px auto;'>
                                <div  style='color: #87ba4d;font-size: 26px;text-align: center;position: relative;top: 30%;transform: translateY(-30%);'>提交成功!</div>
                                <div class='successMessage' style='color: #87ba4d;font-size: 14px;text-align: center;position: relative;top: 50%;transform: translateY(-50%);'></div>
                                
                            </div>
                            <div  style='background-color: white;height: 74px;width: 100%;border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;'>
                                <div style='border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;font-size: 18px;color: #469ee3;height: 74px;width: 100%;line-height: 74px;text-align: center;border-top: 1px solid #d2ebff'>
                                    <script>
                                        function success(){
                                            window.location.href = '?action=daifankui';
                                        }
                                    </script>
                                    <button onclick='success();' style='background-color: #3e8ffe;width: 210px;height: 48px;border-radius: 10px;color: white;position: relative;font-size: 16px;margin: 0 auto;position: relative;top: 50%;transform: translateY(-50%);'>确定</button>
                                </div>
                            </div>
                        </div>
                    </div>";
        return $str;
    }

}